namespace Resonator.Tests.Services
{
	using System.IO;
	using NUnit.Framework;
	using Resonator.Core.Services;
	using Resonator.Domain.Models;
	using Resonator.Domain.Services;

	[TestFixture]
	[Category("ParserProvider")]
	public class ResourceParserProviderTester
	{
		[Test]
		public void Resx_Stream_Yields_Resx_Parser()
		{
			IResourceParserProvider parserProvider = new ResourceParserProvider(); 
			ResourceStream stream = new ResourceStream( "Parser.resx", new MemoryStream() );
			IResourceParser providedParser = parserProvider.Get( stream );

			Assert.IsAssignableFrom( typeof( ResxResourceParser ), providedParser ); 
		}

		[Test]
		public void Zip_Stream_Yields_Zip_Parser()
		{
			IResourceParserProvider parserProvider = new ResourceParserProvider();
			ResourceStream stream = new ResourceStream("Parser.zip", new MemoryStream());
			IResourceParser providedParser = parserProvider.Get(stream);

			Assert.IsAssignableFrom(typeof(ZipResourceParser), providedParser);
		}

		[Test]
		public void Unknown_Stream_Yields_Null_Parser()
		{
			IResourceParserProvider parserProvider = new ResourceParserProvider();
			ResourceStream stream = new ResourceStream("Parser.unknown", new MemoryStream());
			IResourceParser providedParser = parserProvider.Get(stream);

			Assert.IsNull( providedParser ); 
		}
	}
}